package com.mapproject.industrymap.controller;


import com.alibaba.fastjson.JSON;
import com.mapproject.industrymap.entity.BaseInfoEntity;
import com.mapproject.industrymap.service.FoodassetsBaseInfoService;
import com.mapproject.industrymap.utils.ReturnValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.List;

@RestController
@RequestMapping("/baseinfo")
public class FoodassetsBaseInfoController {
    @Autowired
    FoodassetsBaseInfoService foodassetsBaseInfoService;

    /**
     * 获取基础信息表publicfoodassets_baseinfo数据
     * @param rowguid （"all":查询所有，rowguid查询对应单条记录）
     * @return
     */
    @RequestMapping(value = "/query")
    public ReturnValue querydata(@RequestParam(value = "rowguid")String rowguid){
        String  result=foodassetsBaseInfoService.retrievedata(rowguid);
        return  new ReturnValue(200,"查询结果", JSON.parse(result));
    }
    @RequestMapping(value = "/update")
    public ReturnValue updatedata(@RequestBody BaseInfoEntity baseinfoentity){
        ReturnValue result=foodassetsBaseInfoService.updatedata(baseinfoentity);
        return  result;
    }

    /**
     * 获取大地块名称与rowguid
     * @return
     */
    @RequestMapping(value = "/getnameandid")
    public ReturnValue queryname(){
        ReturnValue  result=foodassetsBaseInfoService.queryname();
        return   result;
    }
}
